<template>
  <div class="hero">
    <!-- 樱花飘落动画背景 -->
    <div class="sakura-fall" v-for="i in 20" :key="i"></div>
    <div class="hero-content">
      <h2>樱花纷飞的技术博客</h2>
      <p>记录编程路上的点点滴滴与生活感悟</p>
      <button @click="goToArticles">探索文章 <span>→</span></button>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
const router = useRouter()
const goToArticles = () => router.push('/articles')
</script>

<style scoped>
.hero {
  height: 600px;
  background: linear-gradient(135deg, #E3F2FD 0%, #90CAF9 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

/* 樱花飘落动画 */
.sakura-fall {
  position: absolute;
  top: -10%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2390CAF9'%3E%3Cpath d='M12 2L14.5 8H21L16 12L18 18L12 15L6 18L8 12L3 8H9.5L12 2Z'/%3E%3C/svg%3E");
  background-size: contain;
  width: 20px;
  height: 20px;
  animation: fall linear infinite;
}

/* 随机动画延迟和持续时间 */
.sakura-fall:nth-child(odd) {
  left: calc(10% + (var(--random-left) * 80%));
  animation-duration: calc(8s + (var(--random-duration) * 4s));
  animation-delay: calc(var(--random-delay) * 5s);
  transform: scale(calc(0.5 + var(--random-scale) * 0.5));
}

.sakura-fall:nth-child(even) {
  left: calc(10% + (var(--random-left) * 80%));
  animation-duration: calc(10s + (var(--random-duration) * 6s));
  animation-delay: calc(var(--random-delay) * 8s);
  transform: scale(calc(0.3 + var(--random-scale) * 0.7));
}

@keyframes fall {
  0% {
    transform: translateY(0) rotate(0deg) scale(var(--scale));
    opacity: 0.8;
  }
  100% {
    transform: translateY(650px) rotate(360deg) scale(var(--scale));
    opacity: 0.4;
  }
}

.hero-content {
  position: relative;
  z-index: 10;
  padding: 2rem;
  border-radius: 15px;
  background-color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(255, 183, 197, 0.3);
}

.hero-content h2 {
  font-family: 'Comic Sans MS', cursive, sans-serif;
  font-size: 2.5rem;
  color: #1976D2;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(255, 183, 197, 0.5);
}

.hero-content p {
  font-family: 'Comic Sans MS', cursive, sans-serif;
  font-size: 1.2rem;
  color: #5D4037;
  margin-bottom: 2rem;
}

button {
  padding: 0.8rem 2rem;
  background-color: #2196F3;
  color: white;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  margin-top: 1.5rem;
  font-size: 16px;
  font-family: 'Comic Sans MS', cursive, sans-serif;
  box-shadow: 0 4px 15px rgba(255, 128, 171, 0.4);
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

button:hover {
  background-color: #FF4081;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(255, 128, 171, 0.6);
}

button span {
  transition: transform 0.3s ease;
}

button:hover span {
  transform: translateX(5px);
}
</style>